﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;

namespace Projekt_GUI.Forms
{
    public partial class ReisenAnsicht : Form
    {
        public string ID = "";
        public ReisenAnsicht(string id)
        {
            InitializeComponent();
            ID = id;
        }

        private void ReisenAnsicht_Load(object sender, EventArgs e)
        {
                using (OracleConnection con = new OracleConnection("Data Source=localhost; User Id=PROJEKT; Password=PROJEKT"))
                {
                    con.Open();
                    OracleCommand com = con.CreateCommand();
                    com.CommandText = "SELECT * FROM Reisen r, Locations l WHERE r.Location = l.Nummer";

                    OracleDataReader r = com.ExecuteReader();

                    int counter = 0;
                    while (r.Read())
                    {
                        webBrowser1.Url = new Uri(r.GetValue(13).ToString());
                        webBrowser2.Url = new Uri("http://www.wetter.de/suche?searchstring="+r.GetValue(11).ToString() + "&x=0&y=0");
                        webBrowser3.Url = new Uri("http://maps.google.de/maps?q=" + r.GetValue(11).ToString());
                        this.Text = r.GetValue(7).ToString();
                        label1.Text = this.Text;
                        label2.Text = r.GetValue(8).ToString();
                        label3.Text = r.GetValue(9).ToString() + " " + r.GetValue(10).ToString();
                        label4.Text = r.GetValue(11).ToString();
                        label5.Text = "Telefon: "+r.GetValue(12).ToString();
                        label6.Text = "Webseite: "+r.GetValue(13).ToString();

                    }

                    webBrowser1.Refresh();
                    webBrowser2.Refresh();
                    webBrowser3.Refresh();
                }
            }
           
        
    }
}
